package com.frame.util;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;

import com.pioneer.app.dev.osuser.user.Userlist;


public class ASecurityTag extends TagSupport  {
	private PageContext pageContext;
	 private Tag parent;
	 private String name;
	 private String label;
	 private String event;
	 private String target;
	 private String href;
	 private String className;
	 private String processcode;
	 private String group;
	 private String onclick;

	public String getEvent() {
		return event;
	}

	public void setEvent(String event) {
		this.event = event;
	}


	public String getTarget() {
		return target;
	}

	public void setTarget(String target) {
		this.target = target;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}


	public String getName() {
		return name;
	}



	public PageContext getPageContext() {
		return pageContext;
	}

	public void setPageContext(PageContext pageContext) {
		this.pageContext = pageContext;
	}

	public void setParent(Tag parent) 
	{
		this.parent=parent;

	}

	public Tag getParent() 
	{
		
		return this.parent;
	}

	public int doStartTag() throws JspException 
	{
		
//		System.out.println("doStartTag");
		return Tag.SKIP_BODY;

	}

	public int doEndTag() throws JspException 
	{
		
//		System.out.println("doEndTag");
		  try 
		  {
		  	StringBuffer message = new StringBuffer(300);  
		  	
		  	if(ProviewTest.isPreview(this.pageContext, processcode)){
		  		
			  	message.append("<a name='").append(name).append("' group='").append(group).append(target==null? "":"' target='"+target+"' ").append("class=\"").append(className).append("\" ").append("href=\"").append(href).append("\"")
			  	.append(onclick==null? "":" onclick=\""+onclick+"\"").append(">").append(label.trim()).append("</a>");
		  	}
		  
		   this.pageContext.getOut().write(message.toString());
		  } catch (Exception e) 
		  {
		   e.printStackTrace();
		  }
		  return Tag.EVAL_PAGE;
	}
	 public void setName(String name) {
		 this.name = name;
		}
	public void release() 
	{
//		System.out.println("release");
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getHref() {
		return href;
	}

	public void setHref(String href) {
		this.href = href;
	}

	public String getProcesscode() {
		return processcode;
	}

	public void setProcesscode(String processcode) {
		this.processcode = processcode;
	}

	public String getGroup() {
		return group;
	}

	public void setGroup(String group) {
		this.group = group;
	}

	public String getOnclick() {
		return onclick;
	}

	public void setOnclick(String onclick) {
		this.onclick = onclick;
	}

	
}
